/**
 *
 * @author Erivaldo Lourenco
 * @author Juliana Cavalcanti
 * 
 */

package br.ufal.ic.p3.Interface.cliente.juridico;

import javax.swing.JInternalFrame;




import br.ufal.ic.p3.Interface.Consulta;
import br.ufal.ic.p3.Interface.TelaPrincipal;
import br.ufal.ic.p3.Interface.cliente.CadastroCliente;
import br.ufal.ic.p3.Interface.funcionario.CadastroFuncionario;
import br.ufal.ic.p3.controle.ControleClienteJuridico;

import javax.swing.GroupLayout.Alignment;
import javax.swing.GroupLayout;
import javax.swing.LayoutStyle.ComponentPlacement;

import java.awt.Color;
import javax.swing.ImageIcon;

public class CadastroClienteJuridico extends JInternalFrame {

    public CadastroClienteJuridico() {
        super("ProgNet - Cadastro Cliente Juridico"); 
        getContentPane().setBackground(Color.WHITE);
        initComponents();
    }
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        labelRazaoSocial = new javax.swing.JLabel();
        campoRazaoSocial = new javax.swing.JTextField();
        labelRua = new javax.swing.JLabel();
        campoRua = new javax.swing.JTextField();
        labelEndereco = new javax.swing.JLabel();
        campoCNPJ = new javax.swing.JTextField();
        labelCNPJ = new javax.swing.JLabel();
        labelTelefone2 = new javax.swing.JLabel();
        campoTelefone2 = new javax.swing.JTextField();
        campoTelefone1 = new javax.swing.JTextField();
        labelTelefone1 = new javax.swing.JLabel();
        labelContato = new javax.swing.JLabel();
        labelEmail = new javax.swing.JLabel();
        campoEmail = new javax.swing.JTextField();
        botaoVoltar = new javax.swing.JButton();
        botaoSalvar = new javax.swing.JButton();
        campoResponsavel = new javax.swing.JTextField();
        labelResponsavel = new javax.swing.JLabel();
        campoTelefoneResponsavel = new javax.swing.JTextField();
        labelTelefoneResponsavel = new javax.swing.JLabel();
        campoCidade = new javax.swing.JTextField();
        labelCidade = new javax.swing.JLabel();
        campoUF = new javax.swing.JComboBox();
        labelUF = new javax.swing.JLabel();
        campoBairro = new javax.swing.JTextField();
        labelBairro = new javax.swing.JLabel();
        campoCEP = new javax.swing.JTextField();
        labelCEP = new javax.swing.JLabel();
        labelDadosPessoais = new javax.swing.JLabel();
        barraMenu = new javax.swing.JMenuBar();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        labelRazaoSocial.setText("Razao Social");

        campoRazaoSocial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoRazaoSocialActionPerformed(evt);
            }
        });

        labelRua.setText("Rua");

        campoRua.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoRuaActionPerformed(evt);
            }
        });

        labelEndereco.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        labelEndereco.setText("Endereco");

        labelCNPJ.setText("CNPJ");

        labelTelefone2.setText("Telefone Pessoal");

        labelTelefone1.setText("Telefone Residencial");

        labelContato.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        labelContato.setText("Contato");

        labelEmail.setText("E-mail");

        campoEmail.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoEmailActionPerformed(evt);
            }
        });

        botaoVoltar.setIcon(new ImageIcon(CadastroClienteJuridico.class.getResource("/br/ufal/ic/p3/imagens/voltar.png"))); // NOI18N
        botaoVoltar.setText("Voltar");
        botaoVoltar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	setVisible(false);
            }
        });
        
        botaoSalvar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/ufal/ic/p3/imagens/salvar.png"))); // NOI18N
        botaoSalvar.setText("Salvar");
        botaoSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	ControleClienteJuridico controle = new ControleClienteJuridico();
               
            	controle.adicionarClienteJuridico(campoRazaoSocial.getText(), campoCNPJ.getText(), 
            			campoResponsavel.getText(), campoTelefoneResponsavel.getText(), 
            			campoRua.getText(), campoCidade.getText(), campoUF.getSelectedItem(), 
            			campoCEP.getColumns(), campoBairro.getText(), campoTelefone1.getText(), 
            			campoTelefone2.getText(), campoEmail.getText());
                
            }
        });

        campoResponsavel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoResponsavelActionPerformed(evt);
            }
        });

        labelResponsavel.setText("Responsavel");

        labelTelefoneResponsavel.setText("Telefone Responsavel");

        campoCidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoCidadeActionPerformed(evt);
            }
        });

        labelCidade.setText("Cidade");

        campoUF.setModel(new javax.swing.DefaultComboBoxModel(new String[] {"", "AC", "AL", "AM", "AP", "BA", "CE", "DF", "ES", "GO", "MA", "MG", "MS", "MT", "PA", "PB", "PE", "PI", "PR", "RJ", "RN", "RO", "RS", "SC", "SE", "SP", "TO"}));

        labelUF.setText("UF");

        labelBairro.setText("Bairro");

        labelCEP.setText("CEP");

        labelDadosPessoais.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
        labelDadosPessoais.setText("Dados Pessoais");

        setJMenuBar(barraMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        layout.setHorizontalGroup(
        	layout.createParallelGroup(Alignment.LEADING)
        		.addGroup(layout.createSequentialGroup()
        			.addContainerGap()
        			.addGroup(layout.createParallelGroup(Alignment.LEADING)
        				.addGroup(layout.createSequentialGroup()
        					.addGroup(layout.createParallelGroup(Alignment.LEADING)
        						.addComponent(labelEmail)
        						.addComponent(campoEmail, GroupLayout.PREFERRED_SIZE, 309, GroupLayout.PREFERRED_SIZE))
        					.addGap(43)
        					.addGroup(layout.createParallelGroup(Alignment.LEADING)
        						.addComponent(labelTelefone1)
        						.addComponent(campoTelefone1, GroupLayout.PREFERRED_SIZE, 232, GroupLayout.PREFERRED_SIZE))
        					.addGroup(layout.createParallelGroup(Alignment.LEADING)
        						.addGroup(layout.createSequentialGroup()
        							.addGap(28)
        							.addComponent(botaoVoltar)
        							.addGap(18)
        							.addComponent(botaoSalvar, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE))
        						.addGroup(Alignment.TRAILING, layout.createSequentialGroup()
        							.addGap(10)
        							.addGroup(layout.createParallelGroup(Alignment.LEADING)
        								.addComponent(labelTelefone2)
        								.addComponent(campoTelefone2, GroupLayout.PREFERRED_SIZE, 240, GroupLayout.PREFERRED_SIZE)))))
        				.addComponent(labelContato)
        				.addComponent(labelEndereco)
        				.addComponent(labelRua)
        				.addComponent(campoRua, GroupLayout.PREFERRED_SIZE, 834, GroupLayout.PREFERRED_SIZE)
        				.addGroup(layout.createSequentialGroup()
        					.addGroup(layout.createParallelGroup(Alignment.LEADING)
        						.addComponent(campoRazaoSocial, GroupLayout.PREFERRED_SIZE, 552, GroupLayout.PREFERRED_SIZE)
        						.addComponent(campoResponsavel, GroupLayout.PREFERRED_SIZE, 552, GroupLayout.PREFERRED_SIZE)
        						.addComponent(labelResponsavel)
        						.addComponent(labelRazaoSocial))
        					.addGap(29)
        					.addGroup(layout.createParallelGroup(Alignment.LEADING)
        						.addComponent(labelTelefoneResponsavel)
        						.addComponent(labelCNPJ)
        						.addComponent(campoTelefoneResponsavel, GroupLayout.PREFERRED_SIZE, 259, GroupLayout.PREFERRED_SIZE)
        						.addComponent(campoCNPJ, GroupLayout.PREFERRED_SIZE, 259, GroupLayout.PREFERRED_SIZE)))
        				.addGroup(layout.createSequentialGroup()
        					.addGroup(layout.createParallelGroup(Alignment.LEADING)
        						.addGroup(layout.createSequentialGroup()
        							.addGap(352)
        							.addGroup(layout.createParallelGroup(Alignment.LEADING)
        								.addComponent(labelBairro)
        								.addComponent(campoBairro, 240, 240, 240)))
        						.addComponent(labelDadosPessoais)
        						.addGroup(layout.createSequentialGroup()
        							.addGroup(layout.createParallelGroup(Alignment.LEADING)
        								.addComponent(labelCidade)
        								.addComponent(campoCidade, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE))
        							.addGap(44)
        							.addGroup(layout.createParallelGroup(Alignment.LEADING)
        								.addComponent(labelUF)
        								.addComponent(campoUF, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
        					.addGap(18)
        					.addGroup(layout.createParallelGroup(Alignment.LEADING)
        						.addComponent(labelCEP)
        						.addComponent(campoCEP, GroupLayout.PREFERRED_SIZE, 224, GroupLayout.PREFERRED_SIZE))))
        			.addContainerGap())
        );
        layout.setVerticalGroup(
        	layout.createParallelGroup(Alignment.LEADING)
        		.addGroup(layout.createSequentialGroup()
        			.addContainerGap()
        			.addComponent(labelDadosPessoais)
        			.addGap(18)
        			.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        				.addComponent(labelRazaoSocial)
        				.addComponent(labelCNPJ))
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        				.addComponent(campoRazaoSocial, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        				.addComponent(campoCNPJ, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        			.addPreferredGap(ComponentPlacement.UNRELATED)
        			.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        				.addComponent(labelResponsavel)
        				.addComponent(labelTelefoneResponsavel))
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addGroup(layout.createParallelGroup(Alignment.LEADING)
        				.addGroup(layout.createSequentialGroup()
        					.addComponent(campoResponsavel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        					.addGap(21)
        					.addComponent(labelEndereco)
        					.addGap(18)
        					.addComponent(labelRua))
        				.addComponent(campoTelefoneResponsavel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addComponent(campoRua, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        			.addPreferredGap(ComponentPlacement.UNRELATED)
        			.addGroup(layout.createParallelGroup(Alignment.LEADING)
        				.addGroup(layout.createSequentialGroup()
        					.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        						.addComponent(labelCidade, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)
        						.addComponent(labelUF, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        						.addComponent(labelBairro, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)
        						.addComponent(labelCEP, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE))
        					.addPreferredGap(ComponentPlacement.RELATED)
        					.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        						.addComponent(campoCidade, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        						.addComponent(campoUF, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
        				.addGroup(layout.createSequentialGroup()
        					.addGap(23)
        					.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        						.addComponent(campoBairro, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        						.addComponent(campoCEP, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))))
        			.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        			.addComponent(labelContato)
        			.addGap(18)
        			.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        				.addComponent(labelEmail)
        				.addComponent(labelTelefone1)
        				.addComponent(labelTelefone2))
        			.addPreferredGap(ComponentPlacement.RELATED)
        			.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        				.addComponent(campoEmail, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        				.addComponent(campoTelefone1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
        				.addComponent(campoTelefone2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
        			.addGap(42)
        			.addGroup(layout.createParallelGroup(Alignment.BASELINE)
        				.addComponent(botaoSalvar, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE)
        				.addComponent(botaoVoltar))
        			.addGap(35))
        );
        getContentPane().setLayout(layout);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void campoRazaoSocialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoRazaoSocialActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoRazaoSocialActionPerformed

    private void campoRuaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoRuaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoRuaActionPerformed

    private void campoEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoEmailActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoEmailActionPerformed

    private void campoResponsavelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoResponsavelActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoResponsavelActionPerformed

    private void campoCidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoCidadeActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_campoCidadeActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(CadastroClienteJuridico.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(CadastroClienteJuridico.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(CadastroClienteJuridico.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(CadastroClienteJuridico.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CadastroClienteJuridico().setVisible(true);
            }
        });
    }
    private javax.swing.JMenuBar barraMenu;
    private javax.swing.JButton botaoVoltar;
    private javax.swing.JButton botaoSalvar;
    private javax.swing.JTextField campoBairro;
    private javax.swing.JTextField campoCEP;
    private javax.swing.JTextField campoCNPJ;
    private javax.swing.JTextField campoCidade;
    private javax.swing.JTextField campoEmail;
    private javax.swing.JTextField campoRazaoSocial;
    private javax.swing.JTextField campoResponsavel;
    private javax.swing.JTextField campoRua;
    private javax.swing.JTextField campoTelefone1;
    private javax.swing.JTextField campoTelefone2;
    private javax.swing.JTextField campoTelefoneResponsavel;
    private javax.swing.JComboBox campoUF;
    private javax.swing.JLabel labelBairro;
    private javax.swing.JLabel labelCEP;
    private javax.swing.JLabel labelCNPJ;
    private javax.swing.JLabel labelCidade;
    private javax.swing.JLabel labelContato;
    private javax.swing.JLabel labelDadosPessoais;
    private javax.swing.JLabel labelEmail;
    private javax.swing.JLabel labelEndereco;
    private javax.swing.JLabel labelRazaoSocial;
    private javax.swing.JLabel labelResponsavel;
    private javax.swing.JLabel labelRua;
    private javax.swing.JLabel labelTelefone1;
    private javax.swing.JLabel labelTelefone2;
    private javax.swing.JLabel labelTelefoneResponsavel;
    private javax.swing.JLabel labelUF;
    // End of variables declaration//GEN-END:variables
}
